<template>
	<view class="conWrap">
		<view class="hei20"></view>
		<view class="detail">
			<view class="detailList">
				<view class="detailListL">设备编号</view>
				<view class="detailListR status">
					<view>{{content.equip}}</view>
					<view class="statusR">{{content.status === '0' ? '待处理' : '已处理'}}</view>
				</view>
			</view>
			
			<view class="detailList">
				<view class="detailListL">告警名称</view>
				<view class="detailListR">{{content.title}}</view>
			</view>
			<view class="detailList">
				<view class="detailListL">告警等级</view>
				<view class="detailListR">
					<view class="warnType flexCenter" :class="{'bgRed':content.type === '1','bgYellow':content.type === '2','bgBlue':content.type === '3'}">{{
						content.type === '1' ? '危险' : (content.type === '2' ? '警告' : '注意' )
					}}</view>
				</view>
			</view>
			<view class="detailList">
				<view class="detailListL">告警时间</view>
				<view class="detailListR">{{content.time}}</view>
			</view>
			<view class="detailList">
				<view class="detailListL">告警源</view>
				<view class="detailListR">{{content.source}}</view>
			</view>
			<view class="detailList">
				<view class="detailListL">告警内容</view>
				<view class="detailListR">{{content.content}}</view>
			</view>
		</view>
		<view class="btnWrap" v-if="content.status === '0'">
			<button @tap="handleClick" class="botBtn">处理</button>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				content: {}
			}
		},
		onLoad(options) {
			console.log(options)
			if (options.param) this.content = JSON.parse(options.param)
		},
		methods: {
			handleClick() {
				uni.navigateTo({
					url: `/pages/warning/handle?param=${JSON.stringify(this.content)}`
				})
			}
		}
	}
</script>

<style>
	
	.conWrap{
		width: 100%;
		min-height: 100vh;
		background-color: #f5f5f5;
	}
	.detail{
		width: 670rpx;
		margin: 0 auto;
		padding: 20rpx 20rpx 40rpx;
		background-color: #fff;
		border-radius: 10rpx;
	}
	.detailList{
		width: 100%;
		padding: 20rpx 0;
		display: flex;
		font-size: 26rpx;
		line-height: 40rpx;
		border-bottom: #f0f0f0 solid 2rpx;
	}
	.detailListL{
		width: 150rpx;
		color: #888;
	}
	.detailListR{
		width: 520rpx;
		color: #333;
	}
	.status{
		display: flex;
		justify-content: space-between;
	}
	.statusR{
		color: #0b93f6;
		font-weight: bold;
	}
	.warnType{
		width: 80rpx;
		height: 40rpx;
		color: #fff;
		border-radius: 6rpx;
	}
	.bgRed{
		background-color: #e61e21;
	}
	.bgYellow{
		background-color: #f2ae05;
	}
	.bgBlue{
		background-color: #0b93f6;
	}
	.btnWrap{
		margin-top: 80rpx;
	}
	.botBtn{
	  background-color: #0b93f6;
	  color: #ffffff;
	  width: 670rpx;
	  height: 80rpx;
	  display: flex;
	  align-items: center;
	  justify-content: center;
	  font-size: 30rpx;
	}
</style>
